package com.thinkfit.jy.fragment;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.common.lib.constant.Constants;
import com.common.lib.fragment.BaseFragment;
import com.common.lib.mvp.contract.EmptyContract;
import com.common.lib.mvp.presenter.EmptyPresenter;
import com.thinkfit.jy.R;
import com.thinkfit.jy.activity.SettingNewOtherActivity;

/**
 * 通用设置界面
 */
public class GeneralSettingFragment extends BaseFragment<EmptyContract.Presenter> implements EmptyContract.View {



    public static GeneralSettingFragment getInstance(int index) {
        Bundle bundle = new Bundle();
        bundle.putInt(Constants.BUNDLE_EXTRA, index);
//        bundle.putInt(Constants.BUNDLE_EXTRA_2, type);
        GeneralSettingFragment fragment = new GeneralSettingFragment();
        fragment.setArguments(bundle);
        return fragment;
    }



    @Override
    protected int getLayoutId() {
        return R.layout.fragment_general_setting;
    }

    @Override
    protected void initView(@NonNull View view, @Nullable Bundle savedInstanceState) {
        setViewsOnClickListener(R.id.cl_language,R.id.cl_region,R.id.cl_display,R.id.cl_wallpaper,R.id.cl_screensaver);


    }



    @Override
    public void onResume() {
        super.onResume();

    }

    @Override
    public void onStop() {
        super.onStop();
        System.out.println("ddddddddddddddddddddddd   AboutFragment ");
//        DeviceTypeUtils.showBackButton(getContext().getApplicationContext());
    }


    @NonNull
    @Override
    protected EmptyContract.Presenter onCreatePresenter() {
        return new EmptyPresenter(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.cl_language:
                Bundle bundle = new Bundle();
                bundle.putInt(Constants.BUNDLE_EXTRA, SettingNewOtherActivity.LANGUAGE);
                openActivity(SettingNewOtherActivity.class,bundle);
                break;
            case R.id.cl_region:
                bundle = new Bundle();
                bundle.putInt(Constants.BUNDLE_EXTRA, SettingNewOtherActivity.REGION);
                openActivity(SettingNewOtherActivity.class,bundle);
                break;
            case R.id.cl_display:
                bundle = new Bundle();
                bundle.putInt(Constants.BUNDLE_EXTRA, SettingNewOtherActivity.DISPLAY);
                openActivity(SettingNewOtherActivity.class,bundle);
                break;
            case R.id.cl_wallpaper:
                bundle = new Bundle();
                bundle.putInt(Constants.BUNDLE_EXTRA, SettingNewOtherActivity.THEME);
                openActivity(SettingNewOtherActivity.class,bundle);
                break;
            case R.id.cl_screensaver:
                bundle = new Bundle();
                bundle.putInt(Constants.BUNDLE_EXTRA, SettingNewOtherActivity.SCREEN_SAVER);
                openActivity(SettingNewOtherActivity.class,bundle);
                break;

        }
    }

}
